//--------------------------------------------------------------------------
// Function to add on load initializer function to list on onload functions
//--------------------------------------------------------------------------

function addOnLoadInitializer(func) {
  var oldonload = document.onLoad;
  if (typeof document.onLoad != 'function') {
    document.onLoad = function() {
      document.body.style.cursor = "wait";
      func();
    }
  } else {
    document.onLoad = function() {
      document.body.style.cursor = "wait";
      oldonload();
      func();
    }
  }
}
//--------------------------------------------------------------------------
// Function to add on unload initializer function to list on onunload functions
//--------------------------------------------------------------------------
function addOnUnloadInitializer(func) {
  var oldonunload = window.onUnload;
  if (typeof window.onUnload != 'function') {
    window.onUnload = func;
  } else {
    window.onUnload = function() {
      oldonunload();
      func();
    }
  }
}
